package sword.T10;

/**
 * @File Info: leetcode -- <Solution>
 * @Author: 18362
 * @Create: 2022-03-23 11:48:50 星期三
 */
class Solution {
    public int fib(int n) {
        if (n <= 1)
            return n;
        int dp1 = 0, dp2 = 1;
        for (int i=2; i<=n; ++i) {
            int temp = (dp1+dp2) % 1000000007;
            dp1 = dp2;
            dp2 = temp;
        }
        return dp2;
    }
}